package main

import (
	"fmt"
	"gin-blog/app/model"
	"gin-blog/route"
	"github.com/gin-contrib/sessions"
	"github.com/gin-contrib/sessions/cookie"
	"github.com/gin-gonic/gin"
	"io"
	"os"
)

func main() {
	gin.DisableConsoleColor()

	// gin-log
	f, _ := os.Create("gin.log")
	gin.DefaultWriter = io.MultiWriter(f)
	
	// db
	model.Connect()
	fmt.Println("db.connect")

	r := gin.Default()
	// session
	store := cookie.NewStore([]byte("secret"))
	r.Use(sessions.Sessions("mysession", store))
	
	// route
	route.Map(r)

	fmt.Println("route.map")
	r.Run()
	fmt.Println("done...")
}

/**
1. log:seelog
 */
